use of randomaccessfile() in java

82

use of randomaccessfile() in java -

// Create a random access file object. 	
     RandomAccessFile file = new RandomAccessFile("myfile.dat", "rw");
// Writing to the file.
     file.writeChar('S');
// Moving file pointer to the beginning. 
    file.seek(0);   
// Reading data from the file.
     System.out.println(file.readChar());

Comments

Submit
0 Comments